package com.liuzhongni.wahahanews.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.liuzhongni.wahahanews.R;

import java.util.ArrayList;

/**
 * Created by admin on 2016/1/7.
 */
public class ViewPagerAdapterOfNew extends FragmentPagerAdapter {
    private ArrayList<Fragment> data;
    private Context context;
    private ArrayList<String> columnData;
    private TextView textView;
    public ViewPagerAdapterOfNew(FragmentManager fm, ArrayList<Fragment> data, Context context,ArrayList<String> columnData) {
        super(fm);
        this.data = data;
        this.context = context;
        this.columnData = columnData;
    }


    @Override
    public Fragment getItem(int position) {
        return data.get(position);
    }

    @Override
    public int getCount() {
        return data.size();
    }

    public View getTabView(int position){
        View view = LayoutInflater.from(context).inflate(R.layout.column_tab_item,null);
        textView = (TextView) view.findViewById(R.id.tv_new_column);
        textView.setText(columnData.get(position));
        return view;
    }

}
